package com.epfresh.bean;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * Created by wzh on 16-7-6.
 */
public class StoreDetail {


    /**
     * "market" : {
     * "id" : 29,
     * "name" : "上海中山副食品批发市场",
     * "shortName" : "中山市场",
     * "provinceId" : 31,
     * "cityId" : 31,
     * "districtId" : 310104,
     * "address" : "上海市徐汇区上海市徐汇区古宜路100号",
     * "status" : 1,
     * "provinceName" : "上海市",
     * "cityName" : "上海市",
     * "districtName" : "徐汇区",
     * "dcIds" : "26,27,28,29",
     * "defaultDcId" : 27,
     * "stores" : null
     * },
     * preSaleProducts : [{"markImageId":null,"tags":[],"preBuyPersonsCount":118,"origin":"赣南","pack":"5公斤/箱","type":2,"id":52,"title":"赣南脐橙净果9斤以上 毛重约10斤装70-80mm 精选大果 甜橙子 新鲜水果","thumbnail":"http://7xp3p0.com2.z0.glb.qiniucdn.com/2016%2F0%2F20%2F1453255324276_564ed5f6N44a14658.jpg-PRODUCTTHUMBNAIL","price":"0.01元/箱","level":"特级","thumbnailId":714,"marketingTime":"2016-01-27","storeId":3}]
     * id : 3
     * favoriteCount : 6
     * isFavorite : false
     * managerPhone : null
     * name : 铜川奇威果业专业合作社
     * images : ["http://7xp3p0.com2.z0.glb.qiniucdn.com/2016%2F0%2F6%2F1452079859118_%E5%A5%87%E5%A8%81%E6%9E%9C%E4%B8%9A_05.png-STOREIMAGE","http://7xp3p0.com2.z0.glb.qiniucdn.com/2016%2F0%2F6%2F1452079865795_%E5%A5%87%E5%A8%81%E6%9E%9C%E4%B8%9A_04.png-STOREIMAGE","http://7xp3p0.com2.z0.glb.qiniucdn.com/2016%2F0%2F6%2F1452079872285_%E5%A5%87%E5%A8%81%E6%9E%9C%E4%B8%9A_03.png-STOREIMAGE","http://7xp3p0.com2.z0.glb.qiniucdn.com/2016%2F0%2F6%2F1452079879786_%E5%A5%87%E5%A8%81%E6%9E%9C%E4%B8%9A_02.png-STOREIMAGE","http://7xp3p0.com2.z0.glb.qiniucdn.com/2016%2F0%2F6%2F1452079885959_%E5%A5%87%E5%A8%81%E6%9E%9C%E4%B8%9A_01.png-STOREIMAGE"]
     * logoUrl : http://7xp3p0.com2.z0.glb.qiniucdn.com/2016%2F0%2F5%2F1451991399629_%E7%BB%84-90%403x.png-STORELOGOBACKGROUND
     * nowSaleProducts : [{"tags":[{"color":"#ff0000","name":"特价"},{"color":"#0077ff","name":"热销"}],"markImageId":1103,"id":30,"title":"奇威精品果 来自铜川印台的好苹果","thumbnail":"http://7xp3p0.com2.z0.glb.qiniucdn.com/2016%2F0%2F5%2F1452002071977_IMG_20151224_093918.jpg-PRODUCTTHUMBNAIL","level":"特级","price":"0.01元/箱","origin":"铜川宜君","thumbnailId":390,"mark":"http://7xp3p0.com2.z0.glb.qiniucdn.com/2016%2F4%2F14%2F1460616850701_%E5%8F%82%E8%80%83%E5%9B%BE%E7%89%871.jpg-PRODUCTMARK","pack":"1斤/箱","type":1,"storeId":3}]
     * backgroundImgUrl : http://7xp3p0.com2.z0.glb.qiniucdn.com/2016%2F0%2F6%2F1452079849646_%E5%BA%97%E9%93%BA%E8%83%8C%E6%99%AF%E5%9B%BE%402x.png-STOREBACKGROUND
     */


    /*
    * 适配绑定中心列表
    * */

    private String bindingStatus;
    /*
    * 折扣的详细信息
    * */
    private String discountInfo;

    public String getBindingStatus() {
        return bindingStatus;
    }

    public void setBindingStatus(String bindingStatus) {
        this.bindingStatus = bindingStatus;
    }

    private String id;
    private int favoriteCount;
    private int fans;
    private boolean isFavorite;
    private String managerPhone;
    private String name;
    private String logoUrl;
    private String backgroundImgUrl;
    private String businessTime;

    //店铺地址
    private String address;
    //企业认证状态
    private String certStatus;
    private String description;
    private String mainBusinessCategoryIds;
    private String mainBusinessCategoryNames;
    //支付方式
    private List<Map> paymentModes;
    private List<Map> deliveryModes;

    private List<StoreCategoryItem> categories;
    private List<Category> topCategories;
    private boolean result = true;
    private boolean hasSeckill;
    private int memberStatus;//会员 1;申请中 2;无 3;重新申请 4;申请会员 5

    public int getMemberStatus() {
        return memberStatus;
    }

    public void setMemberStatus(int memberStatus) {
        this.memberStatus = memberStatus;
    }

    private String homepage;
    /**
     * markImageId : null
     * tags : []
     * preBuyPersonsCount : 118
     * origin : 赣南
     * pack : 5公斤/箱
     * type : 2
     * id : 52
     * title : 赣南脐橙净果9斤以上 毛重约10斤装70-80mm 精选大果 甜橙子 新鲜水果
     * thumbnail : http://7xp3p0.com2.z0.glb.qiniucdn.com/2016%2F0%2F20%2F1453255324276_564ed5f6N44a14658.jpg-PRODUCTTHUMBNAIL
     * price : 0.01元/箱
     * level : 特级
     * thumbnailId : 714
     * marketingTime : 2016-01-27
     * storeId : 3
     */

    private List<ZhengHuoStoreProducts> preSaleProducts;
    private List<String> images;
    /**
     * tags : [{"color":"#ff0000","name":"特价"},{"color":"#0077ff","name":"热销"}]
     * markImageId : 1103
     * id : 30
     * title : 奇威精品果 来自铜川印台的好苹果
     * thumbnail : http://7xp3p0.com2.z0.glb.qiniucdn.com/2016%2F0%2F5%2F1452002071977_IMG_20151224_093918.jpg-PRODUCTTHUMBNAIL
     * level : 特级
     * price : 0.01元/箱
     * origin : 铜川宜君
     * thumbnailId : 390
     * mark : http://7xp3p0.com2.z0.glb.qiniucdn.com/2016%2F4%2F14%2F1460616850701_%E5%8F%82%E8%80%83%E5%9B%BE%E7%89%871.jpg-PRODUCTMARK
     * pack : 1斤/箱
     * type : 1
     * storeId : 3
     */

    private List<ZhengHuoStoreProducts> nowSaleProducts;
    /**
     * id : 29
     * name : 上海中山副食品批发市场
     * shortName : 中山市场
     * provinceId : 31
     * cityId : 31
     * districtId : 310104
     * address : 上海市徐汇区上海市徐汇区古宜路100号
     * status : 1
     * provinceName : 上海市
     * cityName : 上海市
     * districtName : 徐汇区
     * dcIds : 26,27,28,29
     * defaultDcId : 27
     * stores : null
     */

    private Market market;
    /**
     * market : {"id":29,"name":"上海中山副食品批发市场","shortName":"中山市场","provinceId":31,"cityId":31,"districtId":310104,"address":"上海市徐汇区上海市徐汇区古宜路100号","status":1,"provinceName":"上海市","cityName":"上海市","districtName":"徐汇区","dcIds":"26,27,28,29","defaultDcId":27,"stores":null}
     * isAcceptOrders : 1
     */

    private int isAcceptOrders;
    private boolean isDc;

    private List<HomeCommTag> tags;

    //好评率
    private String goodCommentsRate;
    //订单量
    private String orderCount;


    public boolean isHasSeckill() {
        return hasSeckill;
    }

    public void setHasSeckill(boolean hasSeckill) {
        this.hasSeckill = hasSeckill;
    }

    public String getHomepage() {
        return homepage;
    }
    public boolean isHomepage() {
        return homepage !=null && !"".equals(homepage);
    }

    public void setHomepage(String homepage) {
        this.homepage = homepage;
    }

    public String getDiscountInfo() {
        return discountInfo;
    }

    public void setDiscountInfo(String discountInfo) {
        this.discountInfo = discountInfo;
    }

    public String getMainBusinessCategoryIds() {
        return mainBusinessCategoryIds;
    }

    public void setMainBusinessCategoryIds(String mainBusinessCategoryIds) {
        this.mainBusinessCategoryIds = mainBusinessCategoryIds;
    }

    public String getMainBusinessCategoryNames() {
        return mainBusinessCategoryNames;
    }

    public void setMainBusinessCategoryNames(String mainBusinessCategoryNames) {
        this.mainBusinessCategoryNames = mainBusinessCategoryNames;
    }

    public List<Category> getTopCategories() {
        return topCategories;
    }

    public void setTopCategories(List<Category> topCategories) {
        this.topCategories = topCategories;
    }

    public String getGoodCommentsRate() {
        return goodCommentsRate;
    }

    public void setGoodCommentsRate(String goodCommentsRate) {
        this.goodCommentsRate = goodCommentsRate;
    }

    public String getOrderCount() {
        return orderCount;
    }

    public void setOrderCount(String orderCount) {
        this.orderCount = orderCount;
    }

    public List<HomeCommTag> getTags() {
        return tags;
    }

    public void setTags(List<HomeCommTag> tags) {
        this.tags = tags;
    }

    public boolean isDc() {
        return isDc;
    }

    public void setDc(boolean dc) {
        isDc = dc;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public boolean isResult() {
        return result;
    }

    public void setResult(boolean result) {
        this.result = result;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public int getFans() {
        return fans;
    }

    public void setFans(int fans) {
        this.fans = fans;
    }

    public int getFavoriteCount() {
        return favoriteCount;
    }

    public void setFavoriteCount(int favoriteCount) {
        this.favoriteCount = favoriteCount;
    }

    public boolean isFavorite() {
        return isFavorite;
    }

    public void setFavorite(boolean isFavorite) {
        this.isFavorite = isFavorite;
    }

    public String getManagerPhone() {
        return managerPhone;
    }

    public void setManagerPhone(String managerPhone) {
        this.managerPhone = managerPhone;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getLogoUrl() {
        return logoUrl;
    }

    public void setLogoUrl(String logoUrl) {
        this.logoUrl = logoUrl;
    }

    public String getBackgroundImgUrl() {
        return backgroundImgUrl;
    }

    public void setBackgroundImgUrl(String backgroundImgUrl) {
        this.backgroundImgUrl = backgroundImgUrl;
    }

    public List<ZhengHuoStoreProducts> getPreSaleProducts() {
        return preSaleProducts;
    }

    public void setPreSaleProducts(List<ZhengHuoStoreProducts> preSaleProducts) {
        this.preSaleProducts = preSaleProducts;
    }

    public List<String> getImages() {
        return images;
    }

    public void setImages(List<String> images) {
        this.images = images;
    }

    public List<ZhengHuoStoreProducts> getNowSaleProducts() {
        return nowSaleProducts;
    }

    public void setNowSaleProducts(List<ZhengHuoStoreProducts> nowSaleProducts) {
        this.nowSaleProducts = nowSaleProducts;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public Market getMarket() {
        return market;
    }

    public void setMarket(Market market) {
        this.market = market;
    }


    public String getCertStatus() {
        return certStatus;
    }

    public void setCertStatus(String certStatus) {
        this.certStatus = certStatus;
    }

    public List getPaymentModes() {
        return paymentModes;
    }

    public void setPaymentModes(List paymentModes) {
        this.paymentModes = paymentModes;
    }

    public int getIsAcceptOrders() {
        return isAcceptOrders;
    }

    public void setIsAcceptOrders(int isAcceptOrders) {
        this.isAcceptOrders = isAcceptOrders;
    }


    public List getDeliveryModes() {
        return deliveryModes;
    }

    public void setDeliveryModes(List deliveryModes) {
        this.deliveryModes = deliveryModes;
    }


    public List<StoreCategoryItem> getCategories() {
        return categories;
    }

    public void setCategories(List<StoreCategoryItem> categories) {
        this.categories = categories;
    }

    public String getMarketName() {
        if (market != null) {
            return market.getName();
        }
        return "";
    }

    public String getMarketShortName() {
        if (market != null) {
            return market.getShortName();
        }
        return "";
    }
//    UNCERTIFIED(0, "未认证"),
//    CERTIFYING(1, "认证中"),
//    HAS_CERTIFIED(2, "已认证"),
//    REJECTED(3, "认证失败");
    public String getCert() {
        if ("2".equals(certStatus)) {
            return "已通过认证";
        } else if ("1".equals(certStatus)) {
            return "认证中";
        } else if ("3".equals(certStatus)) {
            return "认证失败";
        } else {
            return "未认证";
        }
    }

    public String getPaymentInfo() {
        if (paymentModes != null && paymentModes.size() > 0) {
            String s = "支持";
            for (int i = 0; i < paymentModes.size(); i++) {
                Map<String,String> map = paymentModes.get(i);
                for (String value : map.keySet()) {
                    if (map.get(value) != null && !"".equals(map.get(value))) {
                        s += map.get(value);
                    }
                }
                s += ",";
            }
            return s.substring(0, s.length() - 1);
        }
        return "";
/*        if (paymentModes != null && paymentModes.size() > 0) {
            String s = "支持";
            int index = 0;
            for (int i = 0; i < paymentModes.size(); i++) {
                PaymentModes paymentModes = this.paymentModes.get(i);
                String name = paymentModes.getName();
                if (name != null && !"".equals(name)) {
                    if (index > 0) {
                        s += ",";
                    }
                    s += name;
                    index++;
                }

            }
            return s;
        }
        return "";*/
    }

    public String getDeliveryInfo() {
        if (deliveryModes != null && deliveryModes.size() > 0) {
            String s = "支持";
            for (int i = 0; i < deliveryModes.size(); i++) {
                Map<String,String> map = deliveryModes.get(i);
                for (String value : map.keySet()) {
                    if (map.get(value) != null && !"".equals(map.get(value))) {
                        s += map.get(value);
                    }
                }
                s += ",";
            }
            return s.substring(0, s.length() - 1);
        }
        return "";
/*

            int index = 0;
            for (int i = 0; i < deliveryModes.size(); i++) {
                //DeliveryModes deliveryModes = this.deliveryModes.get(i);
                String name = deliveryModes.get(i).;
                if (name != null && !"".equals(name)) {
                    if (index > 0) {
                        s += ",";
                    }
                    s += name;
                    index++;
                }

            }*/
    }


    public List<ZhengHuoStoreProducts> getMergeGoods() {
        List<ZhengHuoStoreProducts> gs = new ArrayList<>();

        if (nowSaleProducts != null) {
            gs.addAll(nowSaleProducts);
        }
        if (preSaleProducts != null) {
            gs.addAll(preSaleProducts);
        }


        return gs;
    }


    public String getDiscount() {
        return "支持平台及店铺优惠券";
    }

    public boolean isAcceptOrders() {
        //1是接单
        return isAcceptOrders == 1;
    }

    public void setAcceptOrders(boolean isAcceptOrders) {
        this.isAcceptOrders = isAcceptOrders ? 1 : 0;
    }

    public String getBusinessTime() {
        return businessTime == null ? "" : businessTime;
    }

    public void setBusinessTime(String businessTime) {
        this.businessTime = businessTime;
    }
}
